

import React from 'react'
import { useLocation } from 'react-router-dom';
//包装对象
import qs from 'qs'
export default function News() {
  // console.log(qs);
  //可以用来接受传来的参数
  const location = useLocation()
  // console.log("location",location);
  const {news,id} = qs.parse(location.search.split('?')[1])
  //一个对象有要的值
  // console.log(a);
  return (
    <div>
      <p>新闻的名字是：{news}</p>
      <p>编号是：{id}</p>
    </div>
  )
}
